package net.qiqb.ddd.user.application;

import lombok.extern.slf4j.Slf4j;
import net.qiqb.core.executing.annotation.Command;
import net.qiqb.core.executing.annotation.HandleBusiness;
import net.qiqb.core.executing.annotation.ObtainAggregateObject;
import net.qiqb.ddd.user.domain.ExtraAvatarUser;
import net.qiqb.ddd.user.domain.UserAggregateRoot;

/**
 * 用户头像命令
 */
@Slf4j
@Command(ExtraAvatarUser.class)
public class UserAvatarCmd {

    private String avatar;


    public UserAvatarCmd(String avatar) {
        this.avatar = avatar;
    }

    @ObtainAggregateObject
    public ExtraAvatarUser obtain() {
        log.info("获取额外用户头像");
        return new ExtraAvatarUser(avatar);
    }

    @HandleBusiness
    public void handleBusiness(UserAggregateRoot userEntity) {
        log.info("用户头像命令处理业务流程");
    }
}
